package com.android.wordbook;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

//数据库管理类,负责管理数据库的创建、升级工作

public class DBHelper extends SQLiteOpenHelper {
    public static final String DB_NAME = "wordbook.db";
    public static final int DB_VERSION = 1;
    private Context context;

    public DBHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
        this.context=context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //创建表
        String tallySql = "create table word(id integer primary key autoincrement,word,note)";
        db.execSQL(tallySql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }

    @Override
    public void onOpen(SQLiteDatabase db) {
        super.onOpen(db);
    }
}

